package com.gy.paidao.util;

import java.util.ArrayList;
import java.util.List;

/**
 * 作者：gy on 16/4/28
 * 说明：头像更换
 */
public class HeaderChangeManager {

    private static HeaderChangeManager instance;
    private List<HeaderChangeListener> list;

    public static HeaderChangeManager getInstance(){
        if(instance == null){
            instance = new HeaderChangeManager();
        }
        return instance;
    }

    private HeaderChangeManager(){
        list = new ArrayList<>();
    }

    public void addListener(HeaderChangeListener listener){
        list.add(listener);
    }

    public void notifyAllListener(){
        for(HeaderChangeListener listener : list){
            listener.headHasChanger();
        }
    }

    public interface HeaderChangeListener{
        void headHasChanger();
    }

}
